# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=wsfuzzer
pkgver=1.9.5
pkgrel=11
groups=('blackarch' 'blackarch-fuzzer' 'blackarch-webapp')
pkgdesc='A Python tool written to automate SOAP pentesting of web services.'
url='https://www.owasp.org/index.php/Category:OWASP_WSFuzzer_Project'
arch=('any')
license=('LGPL')
depends=('python2' 'python2-pyxml' 'java-environment')
source=("http://downloads.sourceforge.net/project/wsfuzzer/wsfuzzer/version1.9.5/$pkgname-$pkgver.tar.gz")
sha512sums=('1e7551293a0421ff982473f1940e6b4c6c73aeb427336509ed3fb06200fdacafc90c452ee00d3e30c9c21e484dcaf7c849a045c9162765b604440f576daa0075')

prepare() {
  sed -i '1i\#!/usr/bin/env python2' *.py
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/" docs/LICENSE \
    docs/COPYING
  rm docs/{LICENSE,COPYING}
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" docs/*
  rm -rf docs

  cp -La --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 WSFuzzer.py "\$@"
EOF
  chmod +x "$pkgdir/usr/bin/$pkgname"

  find "$pkgdir" -name .svn -exec rm -rf {} +
}

